@layout("/common/_container.html"){
<div class="row">
    <div class="col-sm-12">
        <div class="ibox float-e-margins">
            <div class="ibox-title">
                <h5>账目管理</h5>
            </div>
            <div class="ibox-content">
                <div class="row row-lg">
                    <div class="col-sm-12">
                        <div class="row">

                            <div class="col-sm-3">
                                <div class="input-group">
                                    <div class="input-group-btn">
                                        <button data-toggle="dropdown" class="btn btn-white dropdown-toggle" type="button">
                                            账户
                                        </button>
                                    </div>
                                    <select class="form-control" id="accountid">
                                        <option value="">--全部--</option>
                                        @for(items in accountList){
                                        <option value="${items.id}">${items.accountname}</option>
                                        @}

                                    </select>
                                </div>
                            </div>


                            <div class="col-sm-2">
                                <div class="input-group">
                                    <div class="input-group-btn">
                                        <button data-toggle="dropdown" class="btn btn-white dropdown-toggle" type="button">
                                            收/支
                                        </button>
                                    </div>
                                    <select class="form-control" id="shouZhi" onchange="changeShouZhi()">
                                        <option value="">--全部--</option>
                                        <option value="srlx">-----收入-----</option>
                                        <option value="zclx">-----支出-----</option>
                                    </select>
                                </div>
                            </div>


                            <div class="col-sm-3">
                                <div class="input-group">
                                    <div class="input-group-btn">
                                        <button data-toggle="dropdown" class="btn btn-white dropdown-toggle" type="button">
                                            收支类型
                                        </button>
                                    </div>
                                    <select class="form-control" id="paykind">
                                        <option value="">--全部--</option>
                                    </select>
                                </div>
                            </div>


                            <div class="col-sm-2">
                                <div class="input-group">
                                    <div class="input-group-btn">
                                        <button data-toggle="dropdown" class="btn btn-white dropdown-toggle" type="button">
                                            选择年月:
                                        </button>
                                    </div>
                                    <input type="text" class="form-control" id="month1"  placeholder="全部" readonly  />
                                </div>
                            </div>

                            <div class="col-sm-2">
                                <#button name="搜索" icon="fa-search" clickFun="Items.search()"/>
                            </div>
                        </div>
                        <div class="hidden-xs" id="ItemsTableToolbar" role="group">
                            @if(shiro.hasPermission("/items/add")){
                                <#button name="添加" icon="fa-plus" clickFun="Items.openAddItems()"/>
                            @}
                            @if(shiro.hasPermission("/items/update")){
                                <#button name="修改" icon="fa-edit" clickFun="Items.openItemsDetail()" space="true"/>
                            @}
                            @if(shiro.hasPermission("/items/delete")){
                                <#button name="删除" icon="fa-remove" clickFun="Items.delete()" space="true"/>
                            @}
                        </div>
                        <#table id="ItemsTable"/>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<script src="${ctxPath}/static/modular/items/items/items.js"></script>
<script language="JavaScript">

    laydate.render({
        elem:'#month1'
        ,trigger:'click'
        ,type:'month'
        ,btns: ['confirm']
        ,value:""
        ,done: function(value, date, endDate){//控件选择完毕后的回调---点击日期、清空、现在、确定均会触发。
            $('#month1').val(value);
            // $('#month1').val();

        }
    })

    var classzhichu=[];
    var namezhichu=[];
    var classshouru=[];
    var nameshouru=[];

    function ajax1() {
        $.ajax({
            type: "post", // 以get方式发起请求
            url: Feng.ctxPath + "/items/getMessage", // 将你的请求参数以问号拼接到url中进行参数传递
            success(data) {
                for(var d in data){
                    if(data[d]['v1']=="zclx"){
                        classzhichu.push(data[d]['v2']);
                        namezhichu.push(data[d]['v3']);

                    }
                    else if(data[d]['v1']=="srlx"){
                        classshouru.push(data[d]['v2']);
                        nameshouru.push(data[d]['v3']);

                    }
                    // alert(data[d]['v2']+" "+data[d]['v3']);
                }

            },
            error(data){
                alert("cuowu");
            }

        })
    }
    ajax1();


    function changeShouZhi() {

        var value =$('#shouZhi').val();
        var shouru=document.getElementById("shouZhi");
        var paykind=document.getElementById("paykind");
        paykind.options.length = 0;

        option = new Option("--全部--","");
        paykind.options.add(option);
        if(value=="zclx"){
            for(var i=0;i<classzhichu.length;i++){
                option = new Option(namezhichu[i],classzhichu[i] );
                paykind.options.add(option);
            }
        }
        else if(value=="srlx"){
            for(var i=0;i<classshouru.length;i++){
                option = new Option(nameshouru[i],classshouru[i]);
                paykind.options.add(option);
            }
        }


    }


</script>
@}
